import { makeObservable, observable, action } from 'mobx';

class mobxStore {
  nameSpace = 'mobxStore';
  todoList = [];
  count = 1;

  constructor() {
    // makeAutoObservable(this)
    makeObservable(this, {
      count: observable,
      increment: action,
      addTodoList: action
    });
  }

  increment() {
    this.count++;
  }
  addTodoList(msg) {
    this.todoList.push({
      id: Math.random().toString(8),
      name: msg
    });
  }
}

export default new mobxStore();
